package net.tolkv.tdd;

import java.util.Collection;
import java.util.UUID;

import com.scrumtrek.trainings.tdd.PaySystem;


public class ItemStoreService implements IStoreService {
	private PaySystem paySystem;
	private IStoreService storeService;
	public void addItem(Item item) {
		getStoreService().addItem(item);
	}

	public Collection<Item> getItems() {
		return getStoreService().getItems();
	}

	public void sellItem(Item a) {
		getStoreService().sellItem(a);
		paySystem.increaseProfit(a.getPrice());
	}

	public Item findItem(Item a) {
		return getStoreService().findItem(a);
	}

	public Item findItem(UUID id) {
		return getStoreService().findItem(id);
	}

	public int getTotalItemsAmount() {
		return getStoreService().getTotalItemsAmount();
	}

	public int getProfit() {
		return getStoreService().getProfit();
	}

	
	public ItemStoreService(IStoreService srv) {
		super();
		setStoreService(srv);
	}

	public ItemStoreService(PaySystem paySystem2,IStoreService srv) {
		this(srv);
		this.paySystem = paySystem2;
	}

	public IStoreService getStoreService() {
		return storeService;
	}

	protected void setStoreService(IStoreService storeService) {
		this.storeService = storeService;
	}	
}
